Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Endpoint] Policy Details integration with Ingest APIs #61827

Conversation

paul-tavares
Copy link
Contributor

Summary

Integrate the Policy Details pages with Ingest APIs and persist the Endpoint policy settings to the datasource object.
image

Changes include:

  • Updated PageView component to export components used for the header and body titles as well as new required prop viewType. Component now supports both a List view layout as well as a Detail layout in sync with UX

  • The policy details view is only shown after successfully retrieving the Policy data. A loader is initially shown. If unable to load policy data, the API error received will be displayed (can be seen by using an invalid ID in the URL)
    image

  • Show Fleet Agent summary stats for the given policy in the header

  • Display 1 of two confirmation prompts when clicking the "Save" button, and prior to actually making the API call:

    • If Policy is being used by Agents, then display a message with impact information:
      image
    • If Policy is not being used by Agents, then just confirm the action (no impact information):
      image
  • Success or failures in the update will be presented to the user by a toaster notification on the lower-right hand corner of the browser

Checklist

Delete any items that are not applicable to this PR.

…cy-details-api-integration

# Conflicts:
#	x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/action.ts
#	x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/middleware.ts
#	x-pack/plugins/endpoint/public/applications/endpoint/store/policy_details/selectors.ts
#	x-pack/plugins/endpoint/public/applications/endpoint/view/policy/policy_details.tsx
@paul-tavares paul-tavares requested a review from a team as a code owner March 30, 2020 14:58
@paul-tavares paul-tavares self-assigned this Mar 30, 2020
@paul-tavares paul-tavares added the release_note:skip Skip the PR/issue when compiling release notes label Mar 30, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/endpoint-management (Team:Endpoint Management)

@@ -0,0 +1,35 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this. It sneaked in on my commit. Deleting it now

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-oss-agent / Chrome UI Functional Tests.test/functional/apps/discover/_field_visualize·ts.discover app discover field visualize button should preserve app filters in visualize

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 1 times on tracked branches: https://github.com/elastic/kibana/issues/61714

[00:00:00]       │
[00:01:45]         └-: discover app
[00:01:45]           └-> "before all" hook
[00:01:45]           └-> "before all" hook
[00:09:21]           └-: discover field visualize button
[00:09:21]             └-> "before all" hook
[00:09:21]             └-> "before all" hook
[00:09:21]               │ debg load kibana index with default index pattern
[00:09:21]               │ info [discover] Loading "mappings.json"
[00:09:21]               │ info [discover] Loading "data.json.gz"
[00:09:21]               │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:09:21]               │ info [discover] Created index ".kibana"
[00:09:21]               │ debg [discover] ".kibana" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:09:21]               │ info [discover] Indexed 2 docs into ".kibana"
[00:09:21]               │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana/J1hQB2JOSlmLeY4OhuWxUg] update_mapping [_doc]
[00:09:21]               │ debg Migrating saved objects
[00:09:21]               │ proc [kibana]   log   [14:05:59.457] [info][savedobjects-service] Creating index .kibana_2.
[00:09:21]               │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_2] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:09:21]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] updating number_of_replicas to [0] for indices [.kibana_2]
[00:09:21]               │ proc [kibana]   log   [14:05:59.519] [info][savedobjects-service] Reindexing .kibana to .kibana_1
[00:09:21]               │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:09:21]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] updating number_of_replicas to [0] for indices [.kibana_1]
[00:09:21]               │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] 8057 finished with response BulkByScrollResponse[took=30.9ms,timed_out=false,sliceId=null,updated=0,created=2,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:09:21]               │ info [o.e.c.m.MetaDataDeleteIndexService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana/J1hQB2JOSlmLeY4OhuWxUg] deleting index
[00:09:21]               │ proc [kibana]   log   [14:05:59.855] [info][savedobjects-service] Migrating .kibana_1 saved objects to .kibana_2
[00:09:22]               │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_2/c_VlgOPITKmlZLqzxaybOw] update_mapping [_doc]
[00:09:22]               │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_2/c_VlgOPITKmlZLqzxaybOw] update_mapping [_doc]
[00:09:22]               │ proc [kibana]   log   [14:05:59.916] [info][savedobjects-service] Pointing alias .kibana to .kibana_2.
[00:09:22]               │ proc [kibana]   log   [14:05:59.957] [info][savedobjects-service] Finished in 502ms.
[00:09:22]               │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC"}
[00:09:22]               │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_2/c_VlgOPITKmlZLqzxaybOw] update_mapping [_doc]
[00:09:23]               │ info [logstash_functional] Loading "mappings.json"
[00:09:23]               │ info [logstash_functional] Loading "data.json.gz"
[00:09:23]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.22"
[00:09:23]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.20"
[00:09:23]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.21"
[00:09:25]               │ debg replacing kibana config doc: {"defaultIndex":"logstash-*"}
[00:09:25]               │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-centos-tests-xl-1585661670612301210] [.kibana_2/c_VlgOPITKmlZLqzxaybOw] update_mapping [_doc]
[00:09:25]             └-> should visualize a field in area chart
[00:09:25]               └-> "before each" hook: global before each
[00:09:25]               └-> "before each" hook
[00:09:25]                 │ debg go to discover
[00:09:25]                 │ debg navigating to discover url: http://localhost:6161/app/kibana#/discover
[00:09:25]                 │ debg Navigate to: http://localhost:6161/app/kibana#/discover
[00:09:25]                 │ debg ... sleep(700) start
[00:09:25]                 │ debg browser[INFO] http://localhost:6161/app/kibana?_t=1585663563555#/discover 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:09:25]                 │
[00:09:25]                 │ debg browser[INFO] http://localhost:6161/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:09:26]                 │ debg ... sleep(700) end
[00:09:26]                 │ debg returned from get, calling refresh
[00:09:26]                 │ debg browser[INFO] http://localhost:6161/app/kibana?_t=1585663563555#/discover 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:09:26]                 │
[00:09:26]                 │ debg browser[INFO] http://localhost:6161/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:09:27]                 │ debg currentUrl = http://localhost:6161/app/kibana#/discover
[00:09:27]                 │          appUrl = http://localhost:6161/app/kibana#/discover
[00:09:27]                 │ debg TestSubjects.find(kibanaChrome)
[00:09:27]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:09:30]                 │ debg TestSubjects.find(kibanaChrome)
[00:09:30]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=10000
[00:09:30]                 │ debg browser[INFO] http://localhost:6161/bundles/plugin/data/data.plugin.js 96:139630 "INFO: 2020-03-31T14:06:07Z
[00:09:30]                 │        Adding connection to http://localhost:6161/elasticsearch
[00:09:30]                 │
[00:09:30]                 │      "
[00:09:30]                 │ debg ... sleep(501) start
[00:09:31]                 │ debg ... sleep(501) end
[00:09:31]                 │ debg in navigateTo url = http://localhost:6161/app/kibana#/discover
[00:09:31]                 │ debg TestSubjects.exists(statusPageContainer)
[00:09:31]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:09:33]                 │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:09:34]                 │ debg Setting absolute range to Sep 19, 2015 @ 06:31:44.000 to Sep 23, 2015 @ 18:31:44.000
[00:09:34]                 │ debg TestSubjects.exists(superDatePickerToggleQuickMenuButton)
[00:09:34]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerToggleQuickMenuButton"]') with timeout=20000
[00:09:34]                 │ debg TestSubjects.exists(superDatePickerShowDatesButton)
[00:09:34]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=2500
[00:09:34]                 │ debg TestSubjects.click(superDatePickerShowDatesButton)
[00:09:34]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:09:34]                 │ debg TestSubjects.exists(superDatePickerstartDatePopoverButton)
[00:09:34]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=2500
[00:09:34]                 │ debg TestSubjects.click(superDatePickerendDatePopoverButton)
[00:09:34]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:09:34]                 │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:09:34]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:09:34]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:09:34]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:34]                 │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 23, 2015 @ 18:31:44.000)
[00:09:34]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:09:34]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:34]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:35]                 │ debg ... sleep(500) start
[00:09:35]                 │ debg ... sleep(500) end
[00:09:35]                 │ debg TestSubjects.click(superDatePickerstartDatePopoverButton)
[00:09:35]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:09:35]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:09:36]                 │ debg Find.waitForElementStale with timeout=10000
[00:09:36]                 │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:09:36]                 │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:09:36]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:09:36]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:09:36]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:09:36]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:36]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:36]                 │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 19, 2015 @ 06:31:44.000)
[00:09:36]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:09:36]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:36]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:09:36]                 │ debg TestSubjects.exists(superDatePickerApplyTimeButton)
[00:09:36]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerApplyTimeButton"]') with timeout=2500
[00:09:39]                 │ debg --- retry.tryForTime error: [data-test-subj="superDatePickerApplyTimeButton"] is not displayed
[00:09:39]                 │ debg TestSubjects.click(querySubmitButton)
[00:09:39]                 │ debg Find.clickByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:09:39]                 │ debg Find.findByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:09:40]                 │ debg Find.waitForElementStale with timeout=10000
[00:09:40]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:09:40]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:09:42]               │ debg TestSubjects.click(field-phpmemory)
[00:09:42]               │ debg Find.clickByCssSelector('[data-test-subj="field-phpmemory"]') with timeout=10000
[00:09:42]               │ debg Find.findByCssSelector('[data-test-subj="field-phpmemory"]') with timeout=10000
[00:09:42]               │ debg visualize a phpmemory field
[00:09:42]               │ debg TestSubjects.click(fieldVisualize-phpmemory)
[00:09:42]               │ debg Find.clickByCssSelector('[data-test-subj="fieldVisualize-phpmemory"]') with timeout=10000
[00:09:42]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-phpmemory"]') with timeout=10000
[00:09:43]               │ debg isGlobalLoadingIndicatorVisible
[00:09:43]               │ debg TestSubjects.exists(globalLoadingIndicator)
[00:09:43]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:09:45]               │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:09:45]               │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:09:45]               │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:09:45]               │ debg Inspector.open
[00:09:45]               │ debg TestSubjects.exists(inspectorPanel)
[00:09:45]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=2500
[00:09:48]               │ debg --- retry.tryForTime error: [data-test-subj="inspectorPanel"] is not displayed
[00:09:48]               │ debg TestSubjects.click(openInspectorButton)
[00:09:48]               │ debg Find.clickByCssSelector('[data-test-subj="openInspectorButton"]') with timeout=10000
[00:09:48]               │ debg Find.findByCssSelector('[data-test-subj="openInspectorButton"]') with timeout=10000
[00:09:49]               │ debg TestSubjects.exists(inspectorPanel)
[00:09:49]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=2500
[00:09:49]               │ debg Inspector.expectTableData(0,10,58,320,2,171,080,2,3,240,1,3,520,1,3,880,1,4,120,1,4,640,1,4,760,1,5,680,1,7,160,1,7,400,1,8,400,1,8,800,1,8,960,1,9,400,1,10,280,1,10,840,1,13,080,1,13,360,1)
[00:09:49]               │ debg TestSubjects.find(inspectorPanel)
[00:09:49]               │ debg Find.findByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=10000
[00:09:49]               │ debg Close Inspector
[00:09:49]               │ debg TestSubjects.exists(inspectorPanel)
[00:09:49]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=2500
[00:09:49]               │ debg Closing flyout inspectorPanel
[00:09:49]               │ debg TestSubjects.find(inspectorPanel)
[00:09:49]               │ debg Find.findByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=10000
[00:09:49]               │ debg Waiting up to 20000ms for flyout closed...
[00:09:49]               │ debg TestSubjects.exists(inspectorPanel)
[00:09:49]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=1000
[00:09:50]               │ debg --- retry.tryForTime error: [data-test-subj="inspectorPanel"] is not displayed
[00:09:50]               │ debg TestSubjects.exists(inspectorPanel)
[00:09:50]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="inspectorPanel"]') with timeout=2500
[00:09:53]               │ debg --- retry.tryForTime error: [data-test-subj="inspectorPanel"] is not displayed
[00:09:53]               └- ✓ pass  (11.9s) "discover app discover field visualize button should visualize a field in area chart"
[00:09:53]             └-> should preserve app filters in visualize
[00:09:53]               └-> "before each" hook: global before each
[00:09:53]               └-> "before each" hook
[00:09:53]                 │ debg go to discover
[00:09:53]                 │ debg navigating to discover url: http://localhost:6161/app/kibana#/discover
[00:09:53]                 │ debg Navigate to: http://localhost:6161/app/kibana#/discover
[00:09:54]                 │ debg ... sleep(700) start
[00:09:54]                 │ debg browser[INFO] http://localhost:6161/app/kibana?_t=1585663591838#/discover 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:09:54]                 │
[00:09:54]                 │ debg browser[INFO] http://localhost:6161/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:09:54]                 │ debg ... sleep(700) end
[00:09:54]                 │ debg returned from get, calling refresh
[00:09:54]                 │ debg browser[INFO] http://localhost:6161/app/kibana?_t=1585663591838#/discover 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:09:54]                 │
[00:09:54]                 │ debg browser[INFO] http://localhost:6161/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:09:55]                 │ debg currentUrl = http://localhost:6161/app/kibana#/discover
[00:09:55]                 │          appUrl = http://localhost:6161/app/kibana#/discover
[00:09:55]                 │ debg TestSubjects.find(kibanaChrome)
[00:09:55]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:09:57]                 │ debg TestSubjects.find(kibanaChrome)
[00:09:57]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=10000
[00:09:57]                 │ debg browser[INFO] http://localhost:6161/bundles/plugin/data/data.plugin.js 96:139630 "INFO: 2020-03-31T14:06:34Z
[00:09:57]                 │        Adding connection to http://localhost:6161/elasticsearch
[00:09:57]                 │
[00:09:57]                 │      "
[00:09:57]                 │ debg ... sleep(501) start
[00:09:57]                 │ debg ... sleep(501) end
[00:09:58]                 │ debg in navigateTo url = http://localhost:6161/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(columns:!(_source),filters:!(),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!())
[00:09:58]                 │ debg --- retry.try error: URL changed, waiting for it to settle
[00:09:58]                 │ debg ... sleep(501) start
[00:09:59]                 │ debg ... sleep(501) end
[00:09:59]                 │ debg in navigateTo url = http://localhost:6161/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(columns:!(_source),filters:!(),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!())
[00:09:59]                 │ debg TestSubjects.exists(statusPageContainer)
[00:09:59]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:10:01]                 │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:10:02]                 │ debg Setting absolute range to Sep 19, 2015 @ 06:31:44.000 to Sep 23, 2015 @ 18:31:44.000
[00:10:02]                 │ debg TestSubjects.exists(superDatePickerToggleQuickMenuButton)
[00:10:02]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerToggleQuickMenuButton"]') with timeout=20000
[00:10:02]                 │ debg TestSubjects.exists(superDatePickerShowDatesButton)
[00:10:02]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=2500
[00:10:02]                 │ debg TestSubjects.click(superDatePickerShowDatesButton)
[00:10:02]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerShowDatesButton"]') with timeout=10000
[00:10:02]                 │ debg TestSubjects.exists(superDatePickerstartDatePopoverButton)
[00:10:02]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=2500
[00:10:02]                 │ debg TestSubjects.click(superDatePickerendDatePopoverButton)
[00:10:02]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerendDatePopoverButton"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:10:02]                 │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:10:02]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:10:02]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:10:02]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:02]                 │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 23, 2015 @ 18:31:44.000)
[00:10:02]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:10:02]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:02]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:03]                 │ debg ... sleep(500) start
[00:10:03]                 │ debg ... sleep(500) end
[00:10:03]                 │ debg TestSubjects.click(superDatePickerstartDatePopoverButton)
[00:10:03]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:10:03]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerstartDatePopoverButton"]') with timeout=10000
[00:10:03]                 │ debg Find.waitForElementStale with timeout=10000
[00:10:04]                 │ debg Find.findByCssSelector('div.euiPopover__panel-isOpen') with timeout=10000
[00:10:04]                 │ debg TestSubjects.click(superDatePickerAbsoluteTab)
[00:10:04]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:10:04]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteTab"]') with timeout=10000
[00:10:04]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:10:04]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:04]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:04]                 │ debg TestSubjects.setValue(superDatePickerAbsoluteDateInput, Sep 19, 2015 @ 06:31:44.000)
[00:10:04]                 │ debg TestSubjects.click(superDatePickerAbsoluteDateInput)
[00:10:04]                 │ debg Find.clickByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:04]                 │ debg Find.findByCssSelector('[data-test-subj="superDatePickerAbsoluteDateInput"]') with timeout=10000
[00:10:04]                 │ debg TestSubjects.exists(superDatePickerApplyTimeButton)
[00:10:04]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="superDatePickerApplyTimeButton"]') with timeout=2500
[00:10:07]                 │ debg --- retry.tryForTime error: [data-test-subj="superDatePickerApplyTimeButton"] is not displayed
[00:10:07]                 │ debg TestSubjects.click(querySubmitButton)
[00:10:07]                 │ debg Find.clickByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:10:07]                 │ debg Find.findByCssSelector('[data-test-subj="querySubmitButton"]') with timeout=10000
[00:10:08]                 │ debg Find.waitForElementStale with timeout=10000
[00:10:08]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:08]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:10]               │ debg TestSubjects.click(addFilter)
[00:10:10]               │ debg Find.clickByCssSelector('[data-test-subj="addFilter"]') with timeout=10000
[00:10:10]               │ debg Find.findByCssSelector('[data-test-subj="addFilter"]') with timeout=10000
[00:10:10]               │ debg comboBox.set, comboBoxSelector: filterFieldSuggestionList
[00:10:10]               │ debg TestSubjects.find(filterFieldSuggestionList)
[00:10:10]               │ debg Find.findByCssSelector('[data-test-subj="filterFieldSuggestionList"]') with timeout=10000
[00:10:10]               │ debg comboBox.setElement, value: bytes
[00:10:10]               │ debg comboBox.isOptionSelected, value: bytes
[00:10:12]               │ debg TestSubjects.exists(~comboBoxOptionsList)
[00:10:12]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj~="comboBoxOptionsList"]') with timeout=2500
[00:10:12]               │ debg Find.allByCssSelector('.euiFilterSelectItem[title^="bytes"]') with timeout=2500
[00:10:13]               │ debg TestSubjects.exists(~comboBoxOptionsList)
[00:10:13]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj~="comboBoxOptionsList"]') with timeout=2500
[00:10:15]               │ debg --- retry.tryForTime error: [data-test-subj~="comboBoxOptionsList"] is not displayed
[00:10:16]               │ debg comboBox.set, comboBoxSelector: filterOperatorList
[00:10:16]               │ debg TestSubjects.find(filterOperatorList)
[00:10:16]               │ debg Find.findByCssSelector('[data-test-subj="filterOperatorList"]') with timeout=10000
[00:10:16]               │ debg comboBox.setElement, value: is between
[00:10:16]               │ debg comboBox.isOptionSelected, value: is between
[00:10:19]               │ debg TestSubjects.exists(~comboBoxOptionsList)
[00:10:19]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj~="comboBoxOptionsList"]') with timeout=2500
[00:10:19]               │ debg Find.allByCssSelector('.euiFilterSelectItem[title^="is between"]') with timeout=2500
[00:10:19]               │ debg TestSubjects.exists(~comboBoxOptionsList)
[00:10:19]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj~="comboBoxOptionsList"]') with timeout=2500
[00:10:22]               │ debg --- retry.tryForTime error: [data-test-subj~="comboBoxOptionsList"] is not displayed
[00:10:22]               │ debg TestSubjects.find(filterParams)
[00:10:22]               │ debg Find.findByCssSelector('[data-test-subj="filterParams"]') with timeout=10000
[00:10:32]               │ debg TestSubjects.click(saveFilter)
[00:10:32]               │ debg Find.clickByCssSelector('[data-test-subj="saveFilter"]') with timeout=10000
[00:10:32]               │ debg Find.findByCssSelector('[data-test-subj="saveFilter"]') with timeout=10000
[00:10:33]               │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:10:33]               │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:10:33]               │ debg TestSubjects.click(field-geo.src)
[00:10:33]               │ debg Find.clickByCssSelector('[data-test-subj="field-geo.src"]') with timeout=10000
[00:10:33]               │ debg Find.findByCssSelector('[data-test-subj="field-geo.src"]') with timeout=10000
[00:10:33]               │ debg visualize a geo.src field with filter applied
[00:10:33]               │ debg TestSubjects.click(fieldVisualize-geo.src)
[00:10:33]               │ debg Find.clickByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:10:33]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:10:43]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:10:43]               │      Wait timed out after 10115ms
[00:10:44]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:10:54]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:10:54]               │      Wait timed out after 10038ms
[00:10:54]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:05]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:05]               │      Wait timed out after 10055ms
[00:11:05]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:15]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:15]               │      Wait timed out after 10024ms
[00:11:16]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:26]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:26]               │      Wait timed out after 10017ms
[00:11:26]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:36]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:36]               │      Wait timed out after 10030ms
[00:11:37]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:47]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:47]               │      Wait timed out after 10042ms
[00:11:47]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:11:57]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:11:57]               │      Wait timed out after 10018ms
[00:11:58]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:12:08]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:12:08]               │      Wait timed out after 10060ms
[00:12:08]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:12:18]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:12:18]               │      Wait timed out after 10048ms
[00:12:19]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:12:29]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:12:29]               │      Wait timed out after 10018ms
[00:12:29]               │ debg Find.findByCssSelector('[data-test-subj="fieldVisualize-geo.src"]') with timeout=10000
[00:12:39]               │ debg --- retry.try error: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:12:39]               │      Wait timed out after 10004ms
[00:12:40]               │ debg --- retry.try error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
[00:12:40]               │      Wait timed out after 10004ms
[00:12:40]               │          at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:841:17
[00:12:40]               │          at process._tickCallback (internal/process/next_tick.js:68:7)
[00:12:40]               │ info Taking screenshot "/dev/shm/workspace/kibana/test/functional/screenshots/failure/discover app discover field visualize button should preserve app filters in visualize.png"
[00:12:40]               │ info Current URL is: http://localhost:6161/app/kibana#/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:%272015-09-19T06:31:44.000Z%27,to:%272015-09-23T18:31:44.000Z%27))&_a=(columns:!(_source),filters:!((%27$state%27:(store:appState),meta:(alias:!n,disabled:!f,index:%27logstash-*%27,key:bytes,negate:!f,params:(gte:3500,lt:4000),type:range),range:(bytes:(gte:3500,lt:4000)))),index:%27logstash-*%27,interval:auto,query:(language:kuery,query:%27%27),sort:!())
[00:12:41]               │ info Saving page source to: /dev/shm/workspace/kibana/test/functional/failure_debug/html/discover app discover field visualize button should preserve app filters in visualize.html
[00:12:41]               └- ✖ fail: "discover app discover field visualize button should preserve app filters in visualize"
[00:12:41]               │

Stack Trace

Error: retry.try timeout: Error: retry.try timeout: TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="fieldVisualize-geo.src"])
Wait timed out after 10004ms
    at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:841:17
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
    at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)
    at onFailure (test/common/services/retry/retry_for_success.ts:28:9)
    at retryForSuccess (test/common/services/retry/retry_for_success.ts:68:13)

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@@ -27,7 +27,11 @@ export const EventingCheckbox: React.FC<{
(event: React.ChangeEvent<HTMLInputElement>) => {
if (policyDetailsConfig) {
const newPayload = clone(policyDetailsConfig);
newPayload[os].eventing[protectionField] = event.target.checked;
if (os === OS.linux || os === OS.mac) {
newPayload[os].events.process = event.target.checked;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will eventually be more than just process - we can address in later PRs where we add those forms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. This is where i had trouble earlier with the types and had to include the if branches here. This entire callback will need to be refactored when we add all the other types back to the policy model and start to work the UI for it.

* NOTE: in the near future, this will likely be removed and an API call to EPM will be used to retrieve
* the latest from the Endpoint package
*/
export const generatePolicy = (): PolicyConfig => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is essentially our defaults for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinlog Yes, but this will move to the package registry (as part of the Endpoint package) (here: https://github.com/elastic/package-registry/blob/master/dev/packages/example/endpoint-1.0.0/manifest.yml). Once there, it should not be necessary for us to have this generator here (ok - maybe for UT), and if needed, we can use EPM APIs to retrieve it from the package.

network: boolean;
};
}
type WindowsPolicyConfig = Pick<PolicyConfig['windows'], 'events' | 'malware'>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, this allows us to define the Windows config in a more concise way. Would this help us in updating state in any way in terms of satisfying the type checker? For instance, I want to update linux eventing - OS selection could trip up the type checker, especially as we add more protections.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux (UI only) policy properties are defined further below on line 188.
Maybe the naming here should be changed to UI<os_type>Config.

Copy link
Contributor

@kevinlog kevinlog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple questions, overall LGTM

Copy link
Contributor

@charlie-pichette charlie-pichette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 👍

// FIXME: remove this code once the Default Policy is available in the endpoint package - see: https://github.com/elastic/endpoint-app-team/issues/295
// Until we get the Default configuration into the Endpoint package so that the datasource has
// the expected data structure, we will add it here manually.
if (!policyItem.inputs.length) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinlog - this is where we are injecting the "default" policy into the returned data from the API if not already there (which right now will always be the case)

.endpoint-page-content {
border-left: none;
border-right: none;
&.endpoint--isDetailsView {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see this -- pattern a lot in other css stuffs, does it have a standard meaning? -- pliss teach me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)
Ohhh. I hope I get this right from memory.
In CSS there are a few patterns for managing styles, one is called BEM - Block-Element-Modifier. in that pattern, a Modifier classname is normally defined using the double dash -- (in a past project, the _ was used, but same concept) . Its purpose is to normally drive how other classnames below it will adjust based on its presence.

(there are a few other patterns out there - google BEM vs and you should see the others popup)
😃

.endpoint-header {
padding: ${props => props.theme.eui.euiSizeL};
.endpoint-header {
padding: ${props => props.theme.eui.euiSizeL};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we also want to do margin: 0; here. from the mockies i believe the header words are evensteven in the middle
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOOD EYE 👏
I will make this change in a subsequent PR.

FYI: The extra white space here is noticeable because a bodyHeader is also being used with the PageView component.

@@ -20,24 +20,65 @@ import React, { memo, ReactNode } from 'react';
import styled from 'styled-components';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also just general question on our code organization: do we need to have a separate components folder? or does it make sense to just have all view related stuff just in the view folder? maybe common components can just be top level in the view folder? 🤷‍♀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what I was thinking - top level components folder was reusable across all views.
my approach also was that if a component from one view needs to be re-used in another View, we would elevate that component here for reuse - so that we're not importing from a sibling, only from a parent or a child of the given view/component.

@@ -14,10 +14,10 @@ const entries = <T extends object>(o: T): Array<[keyof T, T[keyof T]]> =>
type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };

/**
* Returns a deep copy of PolicyDetailsConfig
* Returns a deep copy of `UIPolicyConfig` object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wew did it werk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - just needed to get the types right

@paul-tavares paul-tavares merged commit 0eb01ac into elastic:master Mar 31, 2020
@paul-tavares paul-tavares deleted the task/emt-275-policy-details-api-integration branch March 31, 2020 20:37
paul-tavares added a commit to paul-tavares/kibana that referenced this pull request Mar 31, 2020
* implement Policy Details header
* use Ingest APIs to persist (save) policy data to the Datasource
* implement UI behaviour for Save, Cancel
* implement UI bahaviour for when Policy (datasource) can not be retrieved
paul-tavares added a commit that referenced this pull request Mar 31, 2020
* implement Policy Details header
* use Ingest APIs to persist (save) policy data to the Datasource
* implement UI behaviour for Save, Cancel
* implement UI bahaviour for when Policy (datasource) can not be retrieved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants